<% @page_title = "Cadastro :: Instituição :: Bancária :: Banco :: Listando Bancos" %>
<%= error_messages_for "banco" %>
<fieldset class="FieldArea">
  <legend class="FieldAreaTitle">Informações dos Bancos</legend>
  <table class="ControlTable" width="100%" border="0">
    <tr>
      <th colspan="6" style="width: 30%;">Nome</th>
      <th colspan="2" style="width: 10%;">Código</th>
      <th colspan="6" style="width: 30%;">Site</th>
      <th colspan="2" style="width: 10%;">Situação</th>
      <th colspan="4" style="width: 20%; text-align: center;">Opções</th>
    </tr>
    <% odd = 0 %>
    <% for banco in @bancos %>
      <% odd = 1 - odd %>
      <tr>
        <td colspan="6" style="width: 30%;" class="ControlTableRow<%= odd %>"><%= banco.nome %></td>
        <td colspan="2" style="width: 10%;" class="ControlTableRow<%= odd %>"><%= banco.codigo %></td>
        <td colspan="6" style="width: 30%;" class="ControlTableRow<%= odd %>"><%= auto_link(banco.site) %></td>
        <td colspan="2" style="width: 10%;" class="ControlTableRow<%= odd %>"><%= @situacoes.map{|situacao| situacao.nome if  situacao.codigo == banco.situacao} %></td>
        <td colspan="4" style="width: 20%; text-align: right;" class="ControlTableRow<%= odd %>">
          <%= link_to image_tag("/resources/pictures/icons/sefaz/icon-22x22-show.gif", :size => '22x22', :style => 'border: 0px;', :title => 'Mostrar', :alt => 'Mostrar'), banco %>
          <%= link_to image_tag("/resources/pictures/icons/sefaz/icon-22x22-edit_pencil.gif", :size => '22x22', :style => 'border: 0px;', :title => 'Editar', :alt => 'Editar'), edit_banco_path(banco) %>
          <%= link_to image_tag("/resources/pictures/icons/sefaz/icon-22x22-delete.gif", :size => '22x22', :style => 'border: 0px;', :title => 'Destruir', :alt => 'Destruir'), banco, :confirm => 'Você tem certeza?', :method => :delete %>
        </td>
        </tr>
    <% end %>
    <tr>
      <td colspan="20" style="width: 100%; text-align: right;">
         <%= paginar @bancos %>
      </td>
    </tr>
  </table>
</fieldset>
<%= submit_tag "Nova", {:class => 'CommandButton IconNew', :type => 'button', :onclick => "javascript: location.href='/bancos/new'" } %>
<%= submit_tag "Cancelar", {:class => 'CommandButton IconCancel', :type => 'button', :onclick => "javascript: location.href='/'" } %>